package zjh_20230310;

import java.io.File;
import java.io.IOException;
import java.util.List;

public class practise02 {
    public static void main(String[] args) {
        File file = new File("D:\\bbbb");
        delete(file);
    }

    public static void delete(File file) {

        for (File list : file.listFiles()) {
            if (list.isFile()) {
                list.delete();
            }else {
                delete(list);
            }
            if (list.isDirectory()&&list.length()==0){
                list.delete();
            }
        }
        file.delete();
    }

}
